# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=pack
_pkgname=PACK
pkgver=0.0.4
pkgrel=10
pkgdesc='Password Analysis and Cracking Kit.'
groups=('blackarch' 'blackarch-cracker')
url='http://thesprawl.org/projects/pack/'
arch=('any')
license=('custom:unknown')
depends=('python2' 'aspell' 'aspell-en')
source=("http://thesprawl.org/media/projects/PACK-$pkgver.tar.gz"
        'fix-all-the-things.patch')
sha512sums=('0b134d7119daac50f47134d7e8fd8563934390460cb042a3069f90a473a864cd0488e6bbd535bef8fb727cbe1035ed77abdcb2f94f3078d4de8cfbd0dec638f0'
            '136f2128a7a28fef47475f8933d8571f7ff6e28af556414c9d87143127a3aab794fae222d4d1dfdab566056765c5f68341ab88165c2bd2074effc3f708a1e051')

prepare() {
  cd "$_pkgname-$pkgver"

  patch -Np1 -i ../fix-all-the-things.patch
}

package() {
  cd "$_pkgname-$pkgver"

  install -dm 755 $pkgname

  touch "$pkgname"/__init__.py

  install -Dm 755 statsgen.py "$pkgdir/usr/bin/statsgen"
  install -Dm 755 maskgen.py "$pkgdir/usr/bin/maskgen"
  install -Dm 755 policygen.py "$pkgdir/usr/bin/policygen"
  install -Dm 755 rulegen.py "$pkgdir/usr/bin/rulegen"
  install -Dm 644 README "$pkgdir/usr/share/doc/$pkgname/README"

  install -Dm 644 pack/__init__.py "$pkgdir/usr/lib/python2.7/$pkgname/__init__.py"

  install -dm 755 "$pkgdir/usr/lib/python2.7/$pkgname/enchant/checker"
  install -m 644 enchant/*.py "$pkgdir/usr/lib/python2.7/pack/enchant"
  install -m 644 enchant/checker/*.py \
    "$pkgdir/usr/lib/python2.7/$pkgname/enchant/checker"
  install -Dm 644 enchant/lib/enchant/README.txt \
    "$pkgdir/usr/lib/python2.7/$pkgname/enchant/lib/enchant/README.txt"

  install -Dm 644 enchant/share/enchant/README.txt \
    "$pkgdir/usr/lib/python2.7/$pkgname/enchant/share/enchant/README.txt"
  install -Dm 644 enchant/share/enchant/ispell/README.txt \
    "$pkgdir/usr/lib/python2.7/$pkgname/enchant/share/enchant/ispell/README.txt"
  install -Dm 644 enchant/share/enchant/myspell/README.txt \
    "$pkgdir/usr/lib/python2.7/$pkgname/enchant/share/enchant/myspell/README.txt"

  install -dm 755 "$pkgdir/usr/lib/python2.7/$pkgname/enchant/tokenize"
  install -m 644 enchant/tokenize/*.py \
    "$pkgdir/usr/lib/python2.7/$pkgname/enchant/tokenize"
}

